<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <h2>Essential Links</h2>
    <p>{{count}}</p>
    <p>{{count1}}</p>
    <p>{{todo}}</p>
    <button @click="increment">+</button>
    <button @click="decrement">-</button>
    <button @click="test">test</button>
  </div>
</template>

<script>
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default {
  name: 'hello',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App',
      count2: 1234
    }
  },
  computed: {
    count () {
      return this.$store.state.count
    },
    count1 () {
      return this.count2
    },
    todo () {
      return this.$store.getters.doneTodos
    }
  },
  methods: {
    increment () {
      this.$store.commit('increment', {'num': 10})
    },
    decrement () {
      this.$store.commit('decrement')
    },
    test () {
      this.count2++
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  display: inline-block;
  margin: 0 10px;
}

a {
  color: #42b983;
}
</style>
